<template>
	<view class="container">
		<view style="padding: 40rpx; box-sizing: border-box">
			<u--input placeholder="搜索" prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399"
				v-model="searchValue" @change="$u.debounce(searchChange, 1000)"></u--input>
		</view>
		<!-- 分院详情 -->
		<view style="padding: 0 30rpx">
			<view class="branch-court">
				<view class="doctor-list">
					<view class="doctor-item" v-for="item in copylist" :key="item.id" @click="doctorClick(item)">
						<view class="img-box">
							<img :src="
                  item.image
                    ? item.image
                    : baseUrl + '/static/error.png'
                " alt="" />
						</view>
						<view class="text-box">
							<view style="display: flex; justify-content: space-between">
								<view class="name-box">
									<view>
										<text style="margin-right: 20rpx">{{
                      item.doctorName
                    }}</text>
										<text style="font-size: 24rpx">{{
                      item.departmentName
                    }}</text>
									</view>
								</view>
							</view>
							<view class="intro-box"><text>简介：</text>
								{{ item.introduce ? item.introduce : "暂无" }}
							</view>
							<view class="hot-box" v-if="item.hotStoreEvaluate"><text>热评：</text>
								{{
                  item.hotStoreEvaluate.content
                    ? item.hotStoreEvaluate.content
                    : "很好，很不错！"
                }}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		doctorEvaluateList
	} from "@/api/axios/CommentOn.js";
	import store from "@/store/index.js";
	export default {
		data() {
			return {
				doctorList: [],

				beforeData: {},
				openId: "",
				baseURL: this.staticURL,
				searchValue: "",
				copylist: [],
			};
		},
		mounted() {
			let data = new Date().toTimeString();
			console.log(data);
		},
		async created(data) {
			let _this = this;
			this.beforeData = data;
			this.openId = uni.getStorageSync("openId");
			let doctorList = await doctorEvaluateList({
				params: {
					openId: this.openId,
					doctorName: "",
				},
			});
			this.doctorList = doctorList;
			this.copylist = doctorList;
		},
		methods: {
			searchChange(e) {
				this.copylist = this.doctorList.filter((item) => {
					if (item.doctorName.indexOf(this.searchValue) >= 0) {
						return item;
					}
				});
			},
			doctorClick(data) {
				console.log(data, "data");
				uni.navigateTo({
					url: "/pages-makeAnAppointmentCenter/BranchCourtDetail/index?doctorId=" +
						data.id +
						"&storeId=" +
						data.departmentId,
				});
			},
		},
	};
</script>
<style lang='scss'>
	@import "index.scss";
</style>